/**
 *  Create by mason at 2018/12/1
 *  Function: 防止两次连续点击跳转的事件发生
 *  Desc: 事件间隔默认600毫秒
 */

let isCalled = false, timer;

const CallActionsOnce = (functionTobeCalled, interval = 1200) => {
    if (!isCalled) {
        isCalled = true;
        clearTimeout(timer);
        timer = setTimeout(() => {
            isCalled = false;
        }, interval);
        return functionTobeCalled();
    }
}

export default CallActionsOnce
